package com.itheima.service.impl;

import com.itheima.mapper.UserMappper;
import com.itheima.pojo.User;
import com.itheima.service.UserService;
import com.itheima.utils.Md5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMappper userMappper;

    @Override
    public User findByUserName(String username) {
        User  u =  userMappper.findByUserName(username);
        return u;
    }

    @Override
    public void register(String username, String password) {
        // 密码先要加密
        String md5 =    Md5Util.getMD5String(password);
        userMappper.add(username,md5);
    }


}
